<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <!-- 1. 定义一个根标签,未来用来插入动态创建的dom对象 -->
    <div id="root"></div>
    <!-- 2. 引入react和react-dom-->
    <script src="./js/react.development.js"></script>
    <script src="./js/react-dom.development.js"></script>
    <script src="./js/babel.min.js"></script>

    <!-- 3. 根据数据,动态的插件虚拟dom -->
    <!-- type="text/babel" 是告诉babel这个里面的代码需要被编译 -->
    <script type="text/babel">
      //   4. 让react帮我们将虚拟dom创建成真实dom,并渲染到页面
      let age = 17
      let flag = false

      const div = (
        <div>
          {age >= 18 ? (
            <h1>lt和hj,喜欢看的电影</h1>
          ) : (
            <h1>未成年人看的动画片</h1>
          )}

          {flag ? <h1>哈哈哈</h1> : ''}
          {flag && <h1>哈哈哈</h1>}
        </div>
      )
      ReactDOM.render(div, document.getElementById('root'))
    </script>
  </body>
</html>
